<template>
    <div class="nowplaying">
        <filmlist :films="films"/>
    </div>
</template>

<script>
import axios from 'axios'
import Appfooter from '../components/Appfooter.vue'
import Appheader from '../components/Appheader.vue'
import Filmlist from '../components/Filmlist.vue'


export default{
    data() {
        return {
            films:[]
        }
    },
    methods: {
        getfilms(){
            axios.get(`https://m.maizuo.com/gateway?cityId=${this.$store.state.cityid}&pageNum=1&pageSize=10&type=1&k=1590465`,{
                headers:{
                    'X-Host':'mall.film-ticket.film.list'
                }
            })
            .then(res => res.data)
            .then(res => {
                this.films = res.data.films
            })
        },
    },
    filters:{
        format_actor(_val){
            if(_val){
                let names = _val.map(item =>item.name)
                return names.join(' ')
            }else return '暂无演员信息'
            
        }
    },
    created() {
            this.getfilms()
        },
    components:{
            Appheader,
            Appfooter,
            Filmlist
    }
}
</script>

<style lang="less">
    @import '../assets/Less/common.less';
    .nowplaying{
        h1{
            color: orange;
        }
        button{
            border: 0;
            background-color: pink;
            color: #fff;
        }
    }
</style>